<template>
  <view class="container">
    <ve-card :title="item.title" type="none" noneCaseSubTitle="已催缴" v-for="(item, index) in descList" :key="index">
      <ve-cell label="操作人">{{ item.createUserName || '-' }}</ve-cell>
      <ve-cell label="时间">{{ item.createTime || '-' }}</ve-cell>
      <ve-cell label="催缴说明">{{ item.description || '-' }}</ve-cell>
    </ve-card>
    <ve-empty v-if="loaded && descList.length == 0"></ve-empty>
  </view>
</template>

<script setup>
  import { ref } from 'vue'
  import { onLoad } from '@dcloudio/uni-app'
  import { checkCallRecord } from '@/api/asset/car-violation'

  const loaded = ref(false)
  const descList = ref([])
  const getDetail = async (id) => {
    const res = await checkCallRecord({ id: id.id })
    loaded.value = true
    if (res.code === 200) {
      const urgeList = res.result.urgeList || []
      const length = urgeList.length
      urgeList.map((it, index) => {
        it.title = '催缴记录' + (length - index)
      })
      descList.value = urgeList
    }
  }

  onLoad((id) => {
    if (id) {
      getDetail(id)
    }
  })
</script>

<style lang="less" scoped>
  .container {
    background: #f7f8fa;
    padding: 24rpx;
  }
</style>
